package com.pzh.vue.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pzh.vue.pojo.SysFile;
import com.pzh.vue.pojo.SysStudentFile;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface StudentFileMapper extends BaseMapper<SysStudentFile> {
    @Select("select md5 from sys_student_file where md5 = #{md5}")
    String findMd5(@Param("md5") String md5);
    @Insert("insert into sys_student_file (name,type,size,url,md5) values (#{name},#{type},#{size},#{url},#{md5})")
    int saveFile(SysStudentFile studentFile);
    @Select("select url from sys_student_file where md5 = #{md5}")
    String url(@Param("md5") String md5);
    @Delete("delete from sys_student_file where url = #{url}")
    int deleteByUrl(@Param("url") String fileUrl);
    @Select("select name from sys_student_file where url = #{url}")
    String findNameByURL(String fileUrl);
}
